function examSearch_clicked()
{
	var courseName=$('#courseName').val();
	var examName=$('#examName').val();
	$.ajax({
            type: 'Post',
            url: '/mngexam_action_search',
            data: "courseName="+courseName+"&examName="+examName,
			dataType:"json",
            success: function(response) {
                resolveMessage(response);
            }
        })
}
function resolveMessage(msg)
{
	$('#examName').val("");
	if(msg=='failed')
	 alert('系统原因，查询失败。')
	else
	 BuildUpTable(msg)
}
function BuildUpTable(data)
{
	$("#mngexam_table").find("tr[id!='header']&&[id!='template']").remove();
	var table=$("#mngexam_table")
	$(data).each(function(i){
			var row = $("#mngexam_table").find('#template').clone();
			var textFinder="option[value='"+this.courseName+"']";
            $(row).find("#courseTd").text($("#Global_Share_Dictionary").find(textFinder).html());
			$(row).find("#examTd").text(this.examName);
			$(row).find("#courseTd_hidden").text(this.courseName);
			$(row).attr("id","ready");
			$(row).removeClass("hiddenTd");
			if(i%2==0)
			{
				$(row).addClass("colorTr");
				}
            row.appendTo(table);
			})
}
function examDelete_clicked(sender)
{
	var tr=$(sender).parent().parent();
	courseName=$(tr).find("#courseTd_hidden").html();
	examName=$(tr).find("#examTd").html();
	$.ajax({
            type: 'Post',
            url: '/mngexam_action_delete',
            data: "courseName="+courseName+"&examName="+examName,
            success: function(response) {
                if(response=='failed')
	 				alert('系统原因，删除失败。')
				else
				{
					alert('成功删除考试')
					examSearch_clicked();
				}
            }
        })
	}
